package jsd2302.src.File;

import java.io.File;
import java.io.FileFilter;

public class Test06 {
    public static void main(String[] args) {

        /*
        File dir=new File(".");
        if(dir.isDirectory()){
            FileFilter filter=new FileFilter() {
                @Override
                public boolean accept(File file) {
                    String name=file.getName();
                    return name.contains("s");
                }
            };
            File[] subs=dir.listFiles(filter);
            for(File sub:subs){

                System.out.println(sub.getName());
            }
        }
         */

                File dir=new File(".");
                if(dir.isDirectory()){
                    File[] subs=dir.listFiles(file-> file.getName().endsWith(".txt"));
                    for(File sub:subs){
                        System.out.println(sub.getName());
                    }
                }
            }
        }


